﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Tile_Engine;

namespace AGrandVenture
{
    static class EnemyManager
    {
        #region Declarations
        public static List<Enemy> Enemies = new List<Enemy>();
        public static int MaxActiveEnemies = 30;

        #endregion

        #region Initialise
        public static void Initialise()
        {
        }
        #endregion

        #region Enemy Management
        public static void AddEnemy(Enemy newEnemy)
        {
            Enemies.Add(newEnemy);
        }
        #endregion

        #region Update and Draw
        public static void Update(GameTime gameTime)
        {
            for (int x = Enemies.Count - 1; x >= 0; x--)
            {
                Enemies[x].Update(gameTime);
                if (Enemies[x].Destroyed)
                {
                    Enemies.RemoveAt(x);
                }
            }
        }

        public static void Draw(SpriteBatch spriteBatch)
        {
            foreach (Enemy enemy in Enemies)
            {
                enemy.Draw(spriteBatch);
            }
        }

        public static void DrawShadows(SpriteBatch spriteBatch, Vector2 lightVector, double size)
        {
            foreach (Enemy enemy in Enemies)
            {
                enemy.DrawEnemyShadow(spriteBatch, lightVector, size);
            }
        }
        #endregion


    }
}